﻿using Simulation.Framework;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;

namespace Easy.Game2d {

    public partial class UIStorePanel : PanelBase {

        #region override
        public override void Init(params object[]  data) {
            InitComponent();
        }

        public override void Clear() {
            ClearComponent();
        }

        public override void Open() {
            _playState = SingleBehavior<PanelManager>.getInstance().Open<UIPlayStatePanle>(PanelName._playStatePanle);
            _pagePanel = SingleBehavior<PanelManager>.getInstance().Open<UIPagePanel>(PanelName._pagePanel);
            _pagePanel.Close();
            gameObject.SetActive(true);
        }

        public override void Close() {
            gameObject.SetActive(false);
        }
        #endregion

        #region DATA
        private UIPlayStatePanle _playState;
        private UIPagePanel _pagePanel;
        #endregion

        #region LOGIC

        #endregion

        #region BTN
        private void OnBtndoupengButtonClicked()
        {
            //加血量，补血
            if (_playState.value >= 100)
            {
                //_playState.value -= 100;
                _pagePanel.OndoupengButtonClicked();
                EventUtil.DispatchEvent(EventData.AddValueClick, -100);
                //加血量
                //   _pagePanel
            }
        }

        private void OnBtnshanghaiButtonClicked()
        {
            //加伤害
            if (_playState.value >= 100)
            {
                //_playState.value -= 100;
                _pagePanel.OnshanghaiButtonClicked();
                EventUtil.DispatchEvent(EventData.AddValueClick, -100);
                //加血量
                //   _pagePanel
            }
          
        }

        private void OnBtnxueliangButtonClicked()
        {
            if (_playState.value >= 100)
            {
                //_playState.value -= 100;
                _pagePanel.OnxueliangButtonClicked();
                EventUtil.DispatchEvent(EventData.AddValueClick, -100);
                //加血量
                //   _pagePanel
            }
        }
        private void OnBtnOFFButtonClicked()
        {
            Time.timeScale = 1;
            Close();
        }
        #endregion
    }
}
